Use g_autoptr(GHashTable) instead of gs_unref_hashtable
authorMatthew Barnes <mbarnes@redhat.com>
Tue, 5 May 2015 15:43:31 +0000 (11:43 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Thu, 7 May 2015 02:07:10 +0000 (22:07 -0400)
19 files changed:
src/libostree/ostree-bootconfig-parser.c
src/libostree/ostree-repo-checkout.c
src/libostree/ostree-repo-commit.c
src/libostree/ostree-repo-prune.c
src/libostree/ostree-repo-pull.c
src/libostree/ostree-repo-refs.c
src/libostree/ostree-repo-static-delta-compilation-analysis.c
src/libostree/ostree-repo-static-delta-compilation.c
src/libostree/ostree-repo-traverse.c
src/libostree/ostree-repo.c
src/libostree/ostree-rollsum.c
src/libostree/ostree-sysroot-cleanup.c
src/libostree/ostree-sysroot-deploy.c
src/ostree/ot-builtin-commit.c
src/ostree/ot-builtin-diff.c
src/ostree/ot-builtin-fsck.c
src/ostree/ot-builtin-pull-local.c
src/ostree/ot-builtin-refs.c
src/ostree/ot-builtin-reset.c

index 44e9ce8041e4e19842fb7ad5d9659a4a14df804e..6320b5bbe2bd85da6e29c15a47b6648129a41120 100644 (file)
@@ -171,7 +171,7 @@ ostree_bootconfig_parser_write (OstreeBootconfigParser   *self,
   GString *buf = g_string_new ("");
   g_autoptr(GBytes) bytes = NULL;
   guint i;
-  gs_unref_hashtable GHashTable *written_overrides = NULL;
+  g_autoptr(GHashTable) written_overrides = NULL;
 
   written_overrides = g_hash_table_new (g_str_hash, g_str_equal);
 
index 63a089074e555ca7e3ddf645f6846c2f75f2975e..1aeae13e2826233d4ea690f407c2dcbff6369944 100644 (file)
@@ -850,7 +850,7 @@ ostree_repo_checkout_gc (OstreeRepo        *self,
                          GError           **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *to_clean_dirs = NULL;
+  g_autoptr(GHashTable) to_clean_dirs = NULL;
   GHashTableIter iter;
   gpointer key, value;
 
index bb1cef28e5cdf16c7bcb97e13c5edf9e5989c4a5..62e3f78c26431aa709d72b9c4398ceb7d61afdc1 100644 (file)
@@ -2756,8 +2756,8 @@ ostree_repo_write_mtree (OstreeRepo           *self,
     }
   else
     {
-      gs_unref_hashtable GHashTable *dir_metadata_checksums = NULL;
-      gs_unref_hashtable GHashTable *dir_contents_checksums = NULL;
+      g_autoptr(GHashTable) dir_metadata_checksums = NULL;
+      g_autoptr(GHashTable) dir_contents_checksums = NULL;
       gs_unref_variant GVariant *serialized_tree = NULL;
       g_autofree guchar *contents_csum = NULL;
       char contents_checksum_buf[65];
index 854627aeeb3aced0f8fec92c12c4950d38388c9e..b0dc8a669676827014ee71c78789999fe8d3a878 100644 (file)
@@ -150,8 +150,8 @@ ostree_repo_prune (OstreeRepo        *self,
   gboolean ret = FALSE;
   GHashTableIter hash_iter;
   gpointer key, value;
-  gs_unref_hashtable GHashTable *objects = NULL;
-  gs_unref_hashtable GHashTable *all_refs = NULL;
+  g_autoptr(GHashTable) objects = NULL;
+  g_autoptr(GHashTable) all_refs = NULL;
   OtPruneData data = { 0, };
   gboolean refs_only = flags & OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY;
 
index 433f3f5eb371d3820cb988f13e37103517fa8ec7..18b2f279e03a01f52a9b692bbbacc0e45dbe8304 100644 (file)
@@ -1637,8 +1637,8 @@ ostree_repo_pull_with_options (OstreeRepo             *self,
   g_autofree char *path = NULL;
   g_autofree char *baseurl = NULL;
   g_autofree char *metalink_url_str = NULL;
-  gs_unref_hashtable GHashTable *requested_refs_to_fetch = NULL;
-  gs_unref_hashtable GHashTable *commits_to_fetch = NULL;
+  g_autoptr(GHashTable) requested_refs_to_fetch = NULL;
+  g_autoptr(GHashTable) commits_to_fetch = NULL;
   g_autofree char *remote_mode_str = NULL;
   glnx_unref_object OstreeMetalink *metalink = NULL;
   OtPullData pull_data_real = { 0, };
index 723b4479e7c457b403dacbb37466593080b09377..4bb6e0a471dd0f82542dbcf50cf77083ce6bab62 100644 (file)
@@ -293,7 +293,7 @@ ostree_repo_resolve_partial_checksum (OstreeRepo   *self,
   gboolean ret = FALSE;
   static const char hexchars[] = "0123456789abcdef";
   gsize off;
-  gs_unref_hashtable GHashTable *ref_list = NULL;
+  g_autoptr(GHashTable) ref_list = NULL;
   g_autofree char *ret_rev = NULL;
   guint length;
   const char *checksum = NULL;
@@ -497,7 +497,7 @@ ostree_repo_list_refs (OstreeRepo       *self,
                        GError          **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *ret_all_refs = NULL;
+  g_autoptr(GHashTable) ret_all_refs = NULL;
   g_autofree char *remote = NULL;
   g_autofree char *ref_prefix = NULL;
 
index 8bcf43859292eb96dafe7207fabe5c32e53cd53b..a1344e3bdcf95863dce814d68f40f5b13c60c213 100644 (file)
@@ -155,7 +155,7 @@ build_content_sizenames_filtered (OstreeRepo              *repo,
   gboolean ret = FALSE;
   gs_unref_ptrarray GPtrArray *ret_sizenames =
     g_ptr_array_new_with_free_func (_ostree_delta_content_sizenames_free);
-  gs_unref_hashtable GHashTable *sizenames_map =
+  g_autoptr(GHashTable) sizenames_map =
     g_hash_table_new_full (g_str_hash, g_str_equal, NULL, _ostree_delta_content_sizenames_free);
   ostree_cleanup_repo_commit_traverse_iter
     OstreeRepoCommitTraverseIter iter = { 0, };
@@ -231,7 +231,7 @@ _ostree_delta_compute_similar_objects (OstreeRepo                 *repo,
                                        GError                    **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *ret_modified_regfile_content =
+  g_autoptr(GHashTable) ret_modified_regfile_content =
     g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_ptr_array_unref);
   gs_unref_ptrarray GPtrArray *from_sizes = NULL;
   gs_unref_ptrarray GPtrArray *to_sizes = NULL;
index b2e206e853e27aff775308802ba50a93a66d042f..9f988c6bf609bfe97ab48bbad620c020e788a6a3 100644 (file)
@@ -504,8 +504,8 @@ try_content_bsdiff (OstreeRepo                       *repo,
                     GError                          **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *from_bsdiff = NULL;
-  gs_unref_hashtable GHashTable *to_bsdiff = NULL;
+  g_autoptr(GHashTable) from_bsdiff = NULL;
+  g_autoptr(GHashTable) to_bsdiff = NULL;
   g_autoptr(GBytes) tmp_from = NULL;
   g_autoptr(GBytes) tmp_to = NULL;
   g_autoptr(GFileInfo) from_finfo = NULL;
@@ -546,8 +546,8 @@ try_content_rollsum (OstreeRepo                       *repo,
                      GError                          **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *from_rollsum = NULL;
-  gs_unref_hashtable GHashTable *to_rollsum = NULL;
+  g_autoptr(GHashTable) from_rollsum = NULL;
+  g_autoptr(GHashTable) to_rollsum = NULL;
   g_autoptr(GBytes) tmp_from = NULL;
   g_autoptr(GBytes) tmp_to = NULL;
   g_autoptr(GFileInfo) from_finfo = NULL;
@@ -875,16 +875,16 @@ generate_delta_lowlatency (OstreeRepo                       *repo,
   gs_unref_variant GVariant *from_commit = NULL;
   g_autoptr(GFile) root_to = NULL;
   gs_unref_variant GVariant *to_commit = NULL;
-  gs_unref_hashtable GHashTable *to_reachable_objects = NULL;
-  gs_unref_hashtable GHashTable *from_reachable_objects = NULL;
-  gs_unref_hashtable GHashTable *from_regfile_content = NULL;
-  gs_unref_hashtable GHashTable *new_reachable_metadata = NULL;
-  gs_unref_hashtable GHashTable *new_reachable_regfile_content = NULL;
-  gs_unref_hashtable GHashTable *new_reachable_symlink_content = NULL;
-  gs_unref_hashtable GHashTable *modified_regfile_content = NULL;
-  gs_unref_hashtable GHashTable *rollsum_optimized_content_objects = NULL;
-  gs_unref_hashtable GHashTable *bsdiff_optimized_content_objects = NULL;
-  gs_unref_hashtable GHashTable *content_object_to_size = NULL;
+  g_autoptr(GHashTable) to_reachable_objects = NULL;
+  g_autoptr(GHashTable) from_reachable_objects = NULL;
+  g_autoptr(GHashTable) from_regfile_content = NULL;
+  g_autoptr(GHashTable) new_reachable_metadata = NULL;
+  g_autoptr(GHashTable) new_reachable_regfile_content = NULL;
+  g_autoptr(GHashTable) new_reachable_symlink_content = NULL;
+  g_autoptr(GHashTable) modified_regfile_content = NULL;
+  g_autoptr(GHashTable) rollsum_optimized_content_objects = NULL;
+  g_autoptr(GHashTable) bsdiff_optimized_content_objects = NULL;
+  g_autoptr(GHashTable) content_object_to_size = NULL;
 
   if (from != NULL)
     {
index 7b425bbe13ad50684dc3985967472dfbf8625d20..c0d51fe55c5736f137dbfb239f09f18c11c76b0d 100644 (file)
@@ -496,7 +496,7 @@ ostree_repo_traverse_commit (OstreeRepo      *repo,
                              GError         **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *ret_reachable =
+  g_autoptr(GHashTable) ret_reachable =
     ostree_repo_traverse_new_reachable ();
 
   if (!ostree_repo_traverse_commit_union (repo, commit_checksum, maxdepth,
index d21124ff1d2c8e81076932d1f1cd4716b98876d3..225a5b5bb8210ec5edf035ab4cdd1bf0ad689d03 100644 (file)
@@ -2726,7 +2726,7 @@ ostree_repo_list_objects (OstreeRepo                  *self,
                           GError                     **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *ret_objects = NULL;
+  g_autoptr(GHashTable) ret_objects = NULL;
 
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
   g_return_val_if_fail (self->inited, FALSE);
@@ -2781,7 +2781,7 @@ ostree_repo_list_commit_objects_starting_with (OstreeRepo                  *self
                                                GError                     **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *ret_commits = NULL;
+  g_autoptr(GHashTable) ret_commits = NULL;
 
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
   g_return_val_if_fail (self->inited, FALSE);
@@ -3591,7 +3591,7 @@ ostree_repo_regenerate_summary (OstreeRepo     *self,
                                 GError        **error)
 {
   gboolean ret = FALSE;
-  gs_unref_hashtable GHashTable *refs = NULL;
+  g_autoptr(GHashTable) refs = NULL;
   gs_unref_variant_builder GVariantBuilder *refs_builder = NULL;
   gs_unref_variant GVariant *summary = NULL;
   GList *ordered_keys = NULL;
index c6f08766c4338f311309753802bbffe77a385b62..17830f5b23f2eb60cb05ba08f44704c7a86d0754 100644 (file)
@@ -112,8 +112,8 @@ _ostree_compute_rollsum_matches (GBytes                           *from,
                                  GBytes                           *to)
 {
   OstreeRollsumMatches *ret_rollsum = NULL;
-  gs_unref_hashtable GHashTable *from_rollsum = NULL;
-  gs_unref_hashtable GHashTable *to_rollsum = NULL;
+  g_autoptr(GHashTable) from_rollsum = NULL;
+  g_autoptr(GHashTable) to_rollsum = NULL;
   gs_unref_ptrarray GPtrArray *matches = NULL;
   const guint8 *from_buf;
   gsize from_len;
index 7910a1a187db81cb7b74b130e69998a57253ef38..5b8062ac5b5efb191b38c9b22aa2e650f2563ea1 100644 (file)
@@ -294,8 +294,8 @@ cleanup_old_deployments (OstreeSysroot       *self,
   gboolean ret = FALSE;
   struct stat root_stbuf;
   guint i;
-  gs_unref_hashtable GHashTable *active_deployment_dirs = NULL;
-  gs_unref_hashtable GHashTable *active_boot_checksums = NULL;
+  g_autoptr(GHashTable) active_deployment_dirs = NULL;
+  g_autoptr(GHashTable) active_boot_checksums = NULL;
   gs_unref_ptrarray GPtrArray *all_deployment_dirs = NULL;
   gs_unref_ptrarray GPtrArray *all_boot_dirs = NULL;
 
@@ -396,7 +396,7 @@ cleanup_ref_prefix (OstreeRepo         *repo,
 {
   gboolean ret = FALSE;
   g_autofree char *prefix = NULL;
-  gs_unref_hashtable GHashTable *refs = NULL;
+  g_autoptr(GHashTable) refs = NULL;
   GHashTableIter hashiter;
   gpointer hashkey, hashvalue;
 
index 34ab23ebca61f438fd098c8a6837db733621881c..662ef13e2671f12b4df98102a898e8c6e2fd8448 100644 (file)
@@ -1186,7 +1186,7 @@ install_deployment_kernel (OstreeSysroot   *sysroot,
   glnx_fd_close int deployment_dfd = -1;
   g_autofree char *contents = NULL;
   g_autofree char *deployment_version = NULL;
-  gs_unref_hashtable GHashTable *osrelease_values = NULL;
+  g_autoptr(GHashTable) osrelease_values = NULL;
   g_autofree char *linux_relpath = NULL;
   g_autofree char *linux_key = NULL;
   g_autofree char *initramfs_relpath = NULL;
@@ -1468,7 +1468,7 @@ cleanup_legacy_current_symlinks (OstreeSysroot         *self,
 {
   gboolean ret = FALSE;
   guint i;
-  gs_unref_hashtable GHashTable *created_current_for_osname =
+  g_autoptr(GHashTable) created_current_for_osname =
     g_hash_table_new (g_str_hash, g_str_equal);
 
   for (i = 0; i < self->deployments->len; i++)
index f75def1f30aa85a6640a79662276494e56adce9d..233da0f21eb63837a7d59bb4cdbaaaa749e2badc 100644 (file)
@@ -95,7 +95,7 @@ parse_statoverride_file (GHashTable   **out_mode_add,
   gboolean ret = FALSE;
   gsize len;
   char **iter = NULL; /* nofree */
-  gs_unref_hashtable GHashTable *ret_hash = NULL;
+  g_autoptr(GHashTable) ret_hash = NULL;
   g_autoptr(GFile) path = NULL;
   g_autofree char *contents = NULL;
   char **lines = NULL;
@@ -303,7 +303,7 @@ ostree_builtin_commit (int argc, char **argv, GCancellable *cancellable, GError
   gs_unref_variant GVariant *detached_metadata = NULL;
   glnx_unref_object OstreeMutableTree *mtree = NULL;
   g_autofree char *tree_type = NULL;
-  gs_unref_hashtable GHashTable *mode_adds = NULL;
+  g_autoptr(GHashTable) mode_adds = NULL;
   OstreeRepoCommitModifierFlags flags = 0;
   OstreeRepoCommitModifier *modifier = NULL;
   OstreeRepoTransactionStats stats;
index 385d91034dbb11be0dedd5c57d0a1d2993f9cdf1..8e2d237a1344ba77b8bbb4472cf484a8afe2df43 100644 (file)
@@ -180,9 +180,9 @@ ostree_builtin_diff (int argc, char **argv, GCancellable *cancellable, GError **
 
   if (opt_stats)
     {
-      gs_unref_hashtable GHashTable *reachable_a = NULL;
-      gs_unref_hashtable GHashTable *reachable_b = NULL;
-      gs_unref_hashtable GHashTable *reachable_intersection = NULL;
+      g_autoptr(GHashTable) reachable_a = NULL;
+      g_autoptr(GHashTable) reachable_b = NULL;
+      g_autoptr(GHashTable) reachable_intersection = NULL;
       g_autofree char *rev_a = NULL;
       g_autofree char *rev_b = NULL;
       g_autofree char *size = NULL;
index e13c1a8e02304932ed5b3f36136542e77a4e29ed..86ca393740d9f5b9b78a054b55b9e4f2db0cd9a1 100644 (file)
@@ -185,7 +185,7 @@ fsck_reachable_objects_from_commits (OstreeRepo            *repo,
   gboolean ret = FALSE;
   GHashTableIter hash_iter;
   gpointer key, value;
-  gs_unref_hashtable GHashTable *reachable_objects = NULL;
+  g_autoptr(GHashTable) reachable_objects = NULL;
   guint i;
   guint mod;
   guint count;
@@ -244,8 +244,8 @@ ostree_builtin_fsck (int argc, char **argv, GCancellable *cancellable, GError **
   gpointer key, value;
   gboolean found_corruption = FALSE;
   guint n_partial = 0;
-  gs_unref_hashtable GHashTable *objects = NULL;
-  gs_unref_hashtable GHashTable *commits = NULL;
+  g_autoptr(GHashTable) objects = NULL;
+  g_autoptr(GHashTable) commits = NULL;
 
   context = g_option_context_new ("- Check the repository for consistency");
 
index 993c53ecf7a18b4a111e6b21c2ea3c6b12315f92..ec0c00421a49ab988790a14e4c5f10282a4e00e5 100644 (file)
@@ -51,7 +51,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
   g_autofree char *src_repo_uri = NULL;
   glnx_unref_object OstreeAsyncProgress *progress = NULL;
   gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL;
-  gs_unref_hashtable GHashTable *source_objects = NULL;
+  g_autoptr(GHashTable) source_objects = NULL;
 
   context = g_option_context_new ("SRC_REPO [REFS...] -  Copy data from SRC_REPO");
 
@@ -88,7 +88,7 @@ ostree_builtin_pull_local (int argc, char **argv, GCancellable *cancellable, GEr
     {
       g_autoptr(GFile) src_repo_path = g_file_new_for_path (src_repo_arg);
       glnx_unref_object OstreeRepo *src_repo = ostree_repo_new (src_repo_path);
-      gs_unref_hashtable GHashTable *refs_to_clone = NULL;
+      g_autoptr(GHashTable) refs_to_clone = NULL;
 
       refs_to_fetch = g_ptr_array_new_with_free_func (g_free);
 
index 958799009bb385ce787f60bb4d9f5e6ab841ff8a..d5d6f49e60c31ad9ec39fb555cbf315d4929777e 100644 (file)
@@ -41,7 +41,7 @@ ostree_builtin_refs (int argc, char **argv, GCancellable *cancellable, GError **
   GOptionContext *context;
   glnx_unref_object OstreeRepo *repo = NULL;
   const char *refspec_prefix = NULL;
-  gs_unref_hashtable GHashTable *refs = NULL;
+  g_autoptr(GHashTable) refs = NULL;
   GHashTableIter hashiter;
   gpointer hashkey, hashvalue;
 
index eed44c077a61fa044cb34743576512ae0fdc5a28..61f233f7fb11c9668438207809b427d8dffd36b5 100644 (file)
@@ -37,7 +37,7 @@ find_current_ref (OstreeRepo   *repo,
                   GCancellable *cancellable,
                   GError      **error)
 {
-  gs_unref_hashtable GHashTable *refs = NULL;
+  g_autoptr(GHashTable) refs = NULL;
   gchar *ret;
 
   if (!ostree_repo_list_refs (repo, NULL, &refs, cancellable, error))